﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using DbfViewer.Models;

namespace DbfConsoleTests
{
	class Program
	{

		static DataTable PersonTable { get; set; }
		static void InitializePersonTable()
		{
			PersonTable = new DataTable("PersonTable");
			PersonTable.Columns.Add(new DataColumn("Name", typeof(string)));
			PersonTable.Columns.Add(new DataColumn("Age", typeof(int)));
			PersonTable.Rows.Add("Paul", 20);
			PersonTable.Rows.Add("Ivan", 15);
			PersonTable.Rows.Add("Ben", 50);
		}

		static void SaveTest()
		{
			ITableRepository repository = new OleDbTableRepository();
			string fileName = "person.dbf";
			repository.Save(fileName, PersonTable);
		}

		static void LoadTest()
		{
			ITableRepository repository = new OleDbTableRepository();
			var dataTable = repository.Load("person.dbf");
			var view = new DataView(dataTable);
		}

		static void Main(string[] args)
		{
			InitializePersonTable();
			//SaveTest();
			LoadTest();
		}
	}
}
